
***	Figure H.11: Uncertainity indices
	
/*******************************************************************************
		Graph Setup
*******************************************************************************/
	* Manually override Stata scheme
	set scheme s2color
	global graph_style "graphregion(color(white))"
	
	* Manually introduce Okabe-Ito's colorblind-friendly palette
	global black = "0 0 0"
	global orange = "230 159 0"
	global skyblue = "86 180 233"
	global green = "0 158 115"
	global yellow = "240 228 66"
	global blue = "0 114 178"
	global vermillion = "213 94 0"
	global purple = "204 121 167"
	
/*******************************************************************************
		Importing and Cleaning Priyanrajan and Pratap's Dataset
*******************************************************************************/	

	import excel "$datadir/uncertainity/Priyaranjan and Pratap (2020) - Economic Uncertainty Indices - India.xlsx", clear first
	
	drop if mi(Date)
	gen month = mofd(Date)
	tsset month
	order month
	format month %tm
	
	/* Rename Variable for Simplicity */
	ren NewsbasedUI News
	ren LexiconbasedIndex Lexicon
	ren GoogleUI Google	
	
	format News Lexicon Google %10.0g
	
	/* Create 3-Month Average pre-Demonetization for each UI */	
	foreach x of var News Lexicon Google{
		sum `x' if month>=tm(2016m8)&month<=tm(2016m10)
		scalar avg_`x' = r(mean)
	}	
	
	/* Create Macros for Table Setting */	
	forval y = 2016/2018 {
		local jan `jan' `=mdy(1,1,`y')'
	}		

	forval y = 2016/2017 {
		local jul `jul' `=mdy(7,1,`y')'		
	}		
	
	scalar demonetization = td(08nov2016)
	scalar startdt = td(01jan2016)
	scalar enddt = td(31dec2017)

	keep if inlist(yofd(Date), 2016,2017)
	
/*******************************************************************************
		Outputting Graphs
*******************************************************************************/
	
	/* Create Graph w/ Average Line*/
	foreach v of var News {
		#delimit ; 
		twoway 	(line `v' Date, lc("$vermillion") lw(medthick)), 
		$graph_style xlab(`jan' `jul', format(%tdm_Y) noticks labgap(4))  xtitle("")
		xline(`=scalar(demonetization)', lc(black) lw(vthin) lp(dash))
		xtick(`jan' `jul',tlength(*0.75) grid) 
		xmlab(`=scalar(demonetization)' "{it:Demonetization}", notick labsize(small)) 
		ytitle("Uncertainty Index Value")
		legend(on region(lwidth(none)));	
		graph export "$outputdir_fig/Figure_H_11_1.png", replace width(1500) height(1000);
		#delimit cr
	}
	
	foreach v of var Google {
		#delimit ; 
		twoway 	(line `v' Date, lc("$vermillion") lw(medthick)), 
		$graph_style xlab(`jan' `jul', format(%tdm_Y) noticks labgap(4))  xtitle("")
		xline(`=scalar(demonetization)', lc(black) lw(vthin) lp(dash))
		xtick(`jan' `jul',tlength(*0.75) grid) 
		xmlab(`=scalar(demonetization)' "{it:Demonetization}", notick labsize(small)) 
		ytitle("Uncertainty Index Value")
		legend(on region(lwidth(none)));	
		graph export "$outputdir_fig/Figure_H_11_2.png", replace width(1500) height(1000);
		#delimit cr
	}
	
